package com.originskyseed.platform.task.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.originskyseed.platform.task.model.SpreadLimit;

/**
 * 推广上限记录表Mapper类（OSI_SPREAD_LIMIT）
 *
 * @author wlj
 */
public interface SpreadLimitMapper {

	/**
	 * 删除记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(SpreadLimit record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(SpreadLimit record) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(SpreadLimit record) throws Exception;

	/**
	 * 接单数量统计+1
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int updateCountById(String id) throws Exception;

	/**
	 * 接单数量统计-1
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int updateSubtractById(String id) throws Exception;

	/**
	 * 通过对象ID接单数量统计 加
	 * 
	 * @param objId
	 * @param number
	 * @return
	 * @throws Exception
	 */
	public int CountByObjId(@Param("objId") String objId, @Param("number") int number) throws Exception;

	/**
	 * 通过对象ID接单数量统计 减
	 * 
	 * @param id
	 * @param number
	 * @return
	 * @throws Exception
	 */
	public int SubtractByObjId(@Param("objId") String id, @Param("number") int number) throws Exception;

	/**
	 * 批量修改状态
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int updateStateByIds(@Param("list") List<String> ids, @Param("state") int state) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(SpreadLimit record) throws Exception;

	/**
	 * 每个月1号更新推广上限为设置值
	 *
	 * @param state
	 * @return
	 * @throws Exception
	 */
	public int updateNumSetValue(int state) throws Exception;

	/**
	 * 修改设置上限的默认值
	 *
	 * @param num
	 * @return
	 * @throws Exception
	 */
	public int updateNumDefault(int num) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public SpreadLimit selectByPrimaryKey(String id) throws Exception;

	/**
	 * 通过对象ID查询记录
	 *
	 * @param objId
	 * @return
	 * @throws Exception
	 */
	public SpreadLimit selectByObjId(@Param("objId") String objId) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public SpreadLimit selectBySpreadLimit(SpreadLimit record) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<SpreadLimit> selectList(SpreadLimit record) throws Exception;

	/**
	 * 分页查询列表
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<SpreadLimit> selectListByPage(Map<String, Object> params) throws Exception;

	/**
	 * 分页查询列表-所有家族
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<SpreadLimit> selectGroupListByPage(Map<String, Object> params) throws Exception;

}
